{% block component_review_rating %}
    {% set full = points|round(0, 'floor') %}
    {% set left = ((points - full) * 4)|round %}
    {% set left = left / 4 %}

    {% if left > 0 %}
        {% set half = 1 %}
    {% endif %}

    {% set blank = 5 - full - half %}

    {% if altText is not defined %}
        {% set altText = 'detail.reviewAvgRatingAltText'|trans({ '%points%': points|round(1, 'floor'), '%maxPoints%': 5 }) %}
    {% endif %}

    {% block component_review_rating_output %}
        <div class="product-review-rating">
            {% if full > 0 %}
                {% for star in range(1,full) %}
                    {% sw_include '@Storefront/storefront/component/review/point.html.twig' with {
                        type: 'full'
                    } %}
                {% endfor %}
            {% endif %}

            {% if half %}
                {% sw_include '@Storefront/storefront/component/review/point.html.twig' with {
                    type: 'half'
                } %}
            {% endif %}

            {% if blank > 0 %}
                {% for star in range(1,blank) %}
                    {% sw_include '@Storefront/storefront/component/review/point.html.twig' with {
                        type: 'blank'
                    } %}
                {% endfor %}
            {% endif %}
            <p class="product-review-rating-alt-text visually-hidden">
                {{ altText }}
            </p>
        </div>
    {% endblock %}
{% endblock %}
